package com.timmy.google_play.utils;

import com.timmy.google_play.base.LoadingPager;

import java.util.List;
import java.util.Map;

/**
 * Created by Timmy on 2016/12/14.
 */

public class CheckUtils {

    /**
     * 校验请求回来的数据
     */
    public static LoadingPager.LoadedResult checkResData(Object object) {

        if (object == null) {
            return LoadingPager.LoadedResult.EMPTY;
        }

        if (object instanceof List) {

            if (((List) object).size() == 0) {
                return LoadingPager.LoadedResult.EMPTY;
            }
        }


        if (object instanceof Map) {
            if (((Map) object).size() == 0) {
                return LoadingPager.LoadedResult.EMPTY;
            }
        }
        return LoadingPager.LoadedResult.SUCCESS;
    }
}
